jQuery.markasread = function()
{
	var	links = _j('.post .dd .p a[href*="#new"]'),
		len = links.length;
		
	if (len) create_buttons();
	
	function create_buttons()
	{
		for (var i = len; i--;)
		{
			var link = _j(links[i]),
				href = link.attr('href'),
				button = _j('<span class="markasread" style="cursor: pointer; width: 100px; text-align: center" meta:sup="'+href+'"> [Убрать новые] </span>');
			
			link.after(button);

			button.click(function(){
				var that = _j(this), url = that.attr('meta:sup');
				
				loadpost(url, that)
			});
		}
	}
	
	function loadpost(url, button)
	{
		button.html('<img src="safari-extension://com.sergio.pachini.leprapanel-NKDKSQ698R/panel/assets/loading.gif" />');
		
		var object = _j('<img src="'+url+'" style="display: none" />');

		object.appendTo(document.body);
		
		setTimeout(function(){ 
			var link = button.prev();
			button.remove()
			link.remove();
			object.remove();
		}, 1000);
	}
}

_j(document).ready(function(){ jQuery.markasread(); });